<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>${product.name!}价格/参数/图片_${product.brandName!}_${product.categoryNameT!}_安装通</title>
    <meta name="keywords" content="${product.name!},${product.brandName!},${product.categoryNameT!}">
    <meta name="description" content="安装通发售${product.name!}，${product.categoryNameT!}，这里云集了众多的供应商，采购商，制造商。这是${product.name!}的详细页面。我们还为您精选了${product.brandName!}公司黄页、行业资讯、价格行情、展会信息等详细信息。">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <link href="/res/css/mall/mallIndex.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/res/css/common/zoom/zzsc.css">
    <style>
    	#memberPriceWrap{
    		display: inline-block;
    	}
        .sdddq {
            font-size: 20px;
            height: 30px;
            width: 150px;
        }
        #inpT{
            display: inline-block;
            vertical-align: middle;
        }
        #inpl{
            background-color: #f8f8f8;
        }
        #inpr{
            background-color: #f8f8f8;
        }
		.godCar .godInfo .detailTwo dfn.skuChecked{
			border-color: #00ceff;
		}
        .skuChecked{
            color: #00ceff; 
        }

        .skuDisable{
            color: #cad6ca;
        }
        .deleted{
			text-decoration: line-through;
        }
        .plus{
            display: inline-block;
            vertical-align: middle;
        }

        .plus div{
            display: inline-block;
        }
        .plus>div{
        width: auto;}
        
#price{
color: #666;
    font-size: 14px;
    font-weight: normal;
}
    </style>
<body class="liNone">
[#include "/front/common/front_headMal.html"]
<div class="w1200 godCar">
    <h6 class="bread" style="margin-right: 15px;">当前位置：<a href="/" target="_blank">首页</a> &gt;<a target="_blank" href="/selloffer?categoryIds=${product.categoryFId}" > ${product.categoryNameF!} </a>&gt; <a target="_blank" href="/selloffer?categoryIds=${product.categorySId}" >${product.categoryNameS!}</a> &gt;<a target="_blank" href="/selloffer?categoryIds=${product.categoryTId}"> ${product.categoryNameT!}</a></h6>
    <div>
        <div class="con-FangDa" id="fangdajing">
        <!--  -->
         [#if product.titleImg?? && product.titleImg?size > 4 ]
        	<img class="pre detail" alt="" src="/res/images/respective/mall/mall5_06.png" onclick="pre();">
			<img class="next detail" alt="" src="/res/images/respective/mall/mall5_03.png" onclick="next();">
		[/#if]	 
            <div class="con-fangDaIMg">
                <!-- 正常显示的图片-->
                <img src="${product.firstImg!}">
                <!-- 滑块-->
                <div class="magnifyingBegin"></div>
                <!-- 放大镜显示的图片 -->
                <div class="magnifyingShow"><img src="${product.firstImg!}"></div>
            </div>
			<div style="width: 400px;overflow: hidden;">
				 <ul class="con-FangDa-ImgList">
	                [#if product.titleImg?? ]
	                    [#list product.titleImg as img]
	                        [#if img_has_next ]
	                            <li><img src="${img}" data-bigimg="${img}"></li> 
	                        [#else]
	                            <li style="margin-right: 0px;" ><img src="${img}" data-bigimg="${img}"></li>
	                        [/#if]
	                    [/#list]
	                    [#else]
	                    <li><img src="/res/images/common/userLogo_05.png" data-bigimg="/res/images/common/userLogo_05.png"></li> 
	                    <li style="margin-right: 0px;" ><img src="/res/images/common/userLogo_05.png" data-bigimg="/res/images/common/userLogo_05.png"></li>
	                [/#if]
	            </ul>
			</div> 
        </div>
        <div class="godInfo">
            <h3>${product.name!}</h3>
            <h4>${product.subName!}</h4>
            <div class="detail prefer">
                <div style="margin-top: 0px;">
                    <label>品&nbsp;&nbsp;&nbsp;牌：</label>${product.brandName!}
                </div>

                <div >
                    <label>型&nbsp;&nbsp;&nbsp;号：</label>${product.model!}
                </div>

                <div>
                    <label>市场价：</label><strong id="price" class="deleted"></strong>
                </div> 
                
                <div>
                    <label>会员价：</label>
                   	<div id="memberPriceWrap" style="display: none;" >
	                    <strong id="memberPrice" ></strong>
	                    <dfn>会员价</dfn>
	                </div>
                </div> 
                
                <div style="display: inline-block;">
                    <div style="display: inline-block;vertical-align: top;"> 
                    	<div id="hotPriceWrap" >
		                    <strong style="margin-left: 73px;" id="hotPrice"></strong>
		                    <dfn>天天爆品</dfn>
	                    </div>
	                    
		                <div  id="cenPriceWrap"  class="ask" style="display: none;" >
		                    <strong style="margin-left: 73px;" id="cenPrice" ></strong>
		                    <dfn>集采价</dfn> 
		                </div>
                    </div> 
                </div> 
            </div>
            <div class="detail detailTwo">

                [#list models as skus ]
                    <div>
                        <label id="${skus.id!}" >${skus.name!}</label>
                        <div style="display: inline-block;vertical-align: top;width: 400px;"> 
                        [#list skus.list as sku ]
                            <dfn id="${skus.id!}_${sku.id!}" style="margin-bottom: 10px;" attplevel="${skus_index}" attpid="${skus.id}" attskuid="${skus.id!}:${sku.id!}" class="attname attname_${skus.id}"  >${sku.name!}</dfn>
                        [/#list]
                        </div>
                    </div>
                [/#list]

                <div>
                    <label>数&nbsp;&nbsp;&nbsp;量：</label>
                    <div class="plus">
                    	<input class="sdddq" id="inp" style="font-size: 14px; color: #666;" value="1" > </input>
                    </div> 
                    <label style="width: auto;">件&nbsp;&nbsp;(库存<span id="stock" >0</span>件)</label>
                </div>
            </div>
            <div class="buyBut">
                [#if msg?? ]
                <div style="
                        width: 100%;
                        height: 30px;
                        text-align: center;
                        background-color: #ebebeb;
                        padding-top: 9px;
                        margin-bottom: 34px;" >
                    ${msg!}
                </div>
                [#else]
                    <button class="now" type="button" onclick="goBuy()" >立即购买</button>
                    <button type="button" onclick="addToCart()" >加入购物车</button>
                [/#if]
                <span>如需定制，请</span><a href="tencent://message/?uin=2853909665&Site=www.azt365.com&Menu=yes" ><img style="vertical-align: middle;" alt="" src="/res/images/oparaStatus/ear_03.jpg"/>联系客服</a>
            </div>
        </div>
        <div class="store fll" style="float: right;">
            <div style="margin-top: 0px;border: 1px solid #ebebeb;">
                <h3 class="til">
                    <img src="/res/images/sure_03.png">
                    安装通认证企业
                </h3>
                <div class="detail">
                    <h4 style="margin-bottom: 0px;">
                        ${compnay.companyName!}
                    </h4>
                    <h5>
                        联系人：${shop.cantactName!}[#if shop.qq?? && shop.qq!="" ]<a class="connMe"  href="tencent://message/?uin=${shop.qq}&Site=www.azt365.com&Menu=yes" ><img alt="" src="/res/images/oparaStatus/ask.gif" /></a>[/#if]
                    </h5>
                    [#if shop.display == 1]
                    <h5>
                        手机号：<span data="${shop.cantactTel}" >[#if shop.cantactTel??]${(shop.cantactTel!)?substring(0,3)}****${(shop.cantactTel!)?substring(7)}[/#if][#--${shop.telSecret!}--]</span>
                        [#--<dfn class="eye" onclick="showTel(this)"></dfn>--]
                    </h5>
                    [/#if]

                    <h5>
                        [#if shop.phone?? && shop.phone!=""]固话：[#if shop.phone??]${(shop.phone!)?substring(0,3)}****[/#if][/#if]
                    </h5>

                    <h5>
                        地址：${shop.address!}
                    </h5>
                </div>
                <hr>
                <span class="intro" style="padding-top: 0px;">
						<strong>公司简介：</strong>
						<span data-info="${info.companyInfo!}">${info.companyInfo!}</span>
						<a class="more" data-op="kai" onclick="more(this)">[展开]</a>
					</span>
                <button class="toShop" type="button" onclick="location.href='/shop/${shop.id}'">进入店铺</button>
            </div>
        </div>
    </div>
    <div class="godCarDetail">
        <div class="store fll">
            <div class="iterm2" style="margin-top: 0px;">
                <div class="detail" style="margin-left: 0px;">
                    <h4 style="background-color: #f5f5f5;">
                        <span style="margin-left: 15px;">人气商品</span>
                    </h4>
                    <!-- 6个 -->
                    <ul class="hot proType">
                        [#list hots as product ]
                        <li>
                            <p>
                                <a href="/offer/${product.id}.html">
                                <img src="${product.firstImg!}">
                                </a>
                            </p>
                            <span><a href="/offer/${product.id}.html">${product.name!}</a></span>
                            <strong>￥${(product.minMemberPrice!0)?string('.00')}</strong>
                        </li>
                        [/#list]
                    </ul>
                </div>
            </div>
        </div>
        <div class="flr">
            <div class="proTab">
                <button class="tabButt tabButtActive" style="border-left: none;border-right:none;" attype="1" type="button">商品详情</button>
                [#--<button class="tabButt"  type="button">商品评价（<span>10</span>）</button>--]
                <button class="tabButt"  type="button" attype="2" >售后保障</button>
                [#if product.attachfile?? && product.attachfile!=""  ]<a class="flr" target="_blank"  href="${product.attachfile}" ><img src="/res/images/oparaStatus/down_03.png"/>下载商品参数</a>[/#if]
            </div>
            <div style="padding: 15px;">
            [#--
            <div class="iterm1">

                <div style="margin-top: 35px;">
                    <label>商品编号：100212054</label>
                    <label>商品重量：520g</label>
                    <label>尺寸：227mm*120mm*68.2mm</label>
                </div>
                <div>
                    <label>电源长度：约1.8m</label>
                    <label>功能：除甲醛/异味、杀菌</label>
                </div>
                <div>
                    <a>更多参数></a>
                </div>
                <hr/>

            </div>
            --]
                <div id="wrap1"  class="iterm2" style="text-align: left; line-height: 2;">
                    ${product.descr!}
                </div>
                <div id="wrap2"  style="text-align: left; line-height: 2;display: none" >
                    ${product.service!}
                </div>
            </div>

        </div>
    </div>
</div>
[#include "/front/common/front_foot.html"]
</body>
<script src="/res/js/common/jquery.ellipsis.js"></script>
<script type="text/javascript" class="library" src="/res/js/common/zoom/jquery.colorbox-min.js"></script>
<script type="text/javascript" class="library" src="/res/js/common/zoom/zzsc.js"></script>
<script src="/res/js/common/common.js"></script>
<script src="/res/js/common/jQuery.numBox.js"></script>
<script src="/res/third/layer/layer.js"></script>
<script src="/res/third/layer/layer.extends.js"></script>
<script src="/res/js/common/util.js" ></script>
<script src="/res/js/common/js.cookie.js"></script>

<script type="text/javascript">
    var skugroup = ${skugroup!};
    var skumodels =${skumodels!};
    var skumap =${skumap!};
    var signb=${signboolean!0};
    var firstsku=skugroup[0];
    var productId = ${product.id}; 
	var detNum=Math.ceil($(".con-FangDa-ImgList").children("li").size()/4);//产品详情
	var inx=0;
    var currentSkuId=null;
    $(function(){
        $(".store.fll .intro span").ellipsis({maxWidth:220,maxLine:2});
        bref=$(".store.fll span.intro span[data-info]").html();
        $(".godCar .godInfo .detail.prefer>div.ask .askOuter>img").hover(function(){
            $(this).siblings("div").show();
        });
        $(".godCar .godInfo .detail.prefer>div.ask .askOuter>div").mouseleave(function(){
            $(this).hide();
        });  
        
       	$(".godCarDetail .flr .proTab button").click(function(){ 
       		$(this).siblings().removeClass("tabButtActive");
       		$(this).addClass("tabButtActive");
            var attype =  $(this).attr("attype");
            if(attype==1){
                $("#wrap1").show();
                $("#wrap2").hide();
            }else if(attype==2){
                $("#wrap1").hide();
                $("#wrap2").show();
            }
       	})
    });
    function pre(){
    	var marl=$(".con-FangDa-ImgList").css("margin-left"); 
    	if(marl=="0px"){
    		inx=detNum-1; 
    	}else{
    		inx--; 
    	}
    	$(".con-FangDa-ImgList").css("margin-left",-400*inx);
    }
    function next(){
    	var marl=$(".con-FangDa-ImgList").css("margin-left"); 
    	if(parseFloat(marl)==-(detNum-1)*400){
    		inx=0; 
    	}else{
    		inx++; 
    	}
    	$(".con-FangDa-ImgList").css("margin-left",-400*inx);
    }
    $("#inp").inputBox();
    var offer = {
        init:function (skuids) {
            currentSkuId = skumap[skuids].id;
            [#--默认进入页面会选择第一种组合--]
            this.checkOne(skuids);
            this.excludesku();

            var _this=this;
            $(".attname").click(function(){
                if(!$(this).hasClass("skuDisable")){
                    $(".attname_"+$(this).attr("attpid")).removeClass("skuChecked");
                    $(this).addClass("skuChecked");
                    _this.excludesku();
                }else{
                    //$(".attname_"+$(this).attr("attpid")).removeClass("skuChecked");
                    $(".attname").removeClass("skuChecked");
                    $(".attname").addClass("skuDisable");
                    $(this).removeClass("skuDisable").addClass("skuChecked");
                    var attskuid = $(this).attr("attskuid");
                    var level = $(this).attr("attplevel");
                    _this.excludeDisabled(attskuid,level);
                }
            });

        },
        [#--选中这种组合--]
        checkOne:function(skuids){
            var skuarray = skuids.replace(/:/g,"_").split(";");
            skuarray.forEach(function (v) {
                $("#"+v).addClass("skuChecked");
            });
        },
    [#--
        点了一个disabled的,不存在的组合
       则取第一组存在该组合的自动选中
    --]
        excludeDisabled:function(attskuid,level){
            _this=this;
            [#--判断肯定存在的组合 并将它设置为选中--]
            $.each(skugroup,function (i,v) {
                if (new RegExp(attskuid).test(v)) {
                    _this.checkOne(v);
                    return false;
                }
            });
            this.excludesku();
        },
        [#--
        根据选择的组合,过滤其他不存在的组合
        正常项选择过滤, 筛选不存在的组合
        筛选方式:如: 9:17;10:22;11:25
        则:分别验证 X;10:22;11:25,9:17;x;11:25,9:17;10:22;x是否存在来判断对应的组合是否存在
        --]
        excludesku:function (){//
            var skuarray =[];
            $(".skuChecked").each(function () {
                skuarray.push($(this).attr("attskuid"))
            });
            $(".attname").removeClass("skuDisable");

            var presku =[];
            var l = skuarray.length;
            [#--前前选中的组合--]
            var checkedSku  = skuarray.join(";");
            var x =0;
            while (x<l){
                var preskuid = presku.join(";");
                presku.push(skuarray.shift());
                var lastsku = skuarray.join(";");
                var cobj = skumodels[x];
                var preid = cobj.id;
                for(var y=0;y<cobj.list.length;y++){
                    var yobj =  cobj.list[y];
                    var prekey =preid+":"+yobj.id;
                    var prevStr =preskuid!=""?preskuid+";":preskuid;
                    var lastStr =lastsku!=""? ";"+lastsku:lastsku;
                    var key =prevStr+prekey+lastStr;
                    if($.inArray(key,skugroup)==-1){
                        $("#"+prekey.replace(/:/g,"_")).addClass("skuDisable");
                    }
                }
                x++;
            }
            this.changePrice(checkedSku);
        },
        //改价
        changePrice:function(key){
            var c = skumap[key];
            currentSkuId = c.id;

            $("#price").text($.my.currency(c.price,true));

            if(c.memberPrice!=0){//会员
                $("#memberPrice").text($.my.currency(c.memberPrice,true));
                $("#memberPriceWrap").show();
            }else{
                $("#memberPriceWrap").hide();
            }

            if(c.hotPrice!=0){//爆品
                $("#hotPrice").text($.my.currency(c.hotPrice,true));
                $("#hotPriceWrap").show();
            }else{
                $("#hotPriceWrap").hide();
            }


            if(c.cenPrice!=0 && signb==1){//集采
                $("#cenPrice").text($.my.currency(c.cenPrice,true));
                $("#cenPriceWrap").show();
            }else{
                $("#cenPriceWrap").hide();
            }

            $(".deleted").removeClass("deleted");
            $("#price").addClass("deleted");
            //有会员价、爆品价，突出爆品价，全部买家按照爆品价购买；
            if(c.hotPrice!=0){//有爆品
                $("#memberPrice").addClass("deleted");//会员
                if(signb==1 && c.cenPrice!=0){//有身份且有集采价时,取集采价
                    $("#hotPrice").addClass("deleted")
                }else{
                    $("#cenPrice").addClass("deleted");//集采
                }

            }else{
                //无爆品
                if(signb==1 &&  c.cenPrice!=0 ){
                    //有身份,且有集采价时,突出集采
                    $("#memberPrice").addClass("deleted")
                }else{
                    $("#cenPrice").addClass("deleted");//集采
                }

            }

            $("#stock").text(c.stockQuantity);
            $("#inp").inputBox({max:c.stockQuantity},true);
            $("#inp").keyup();
        }
    }.init(firstsku);


    /*验证能不能购买*/
    function hasPermission(fn){
        layer.get({
            url:"/offer/permission",
            data:{productid:productId},
            success:function(data){
                if(data.success){
                    fn();
                }else{
                    layer.msgShort(data.msg);
                }

            }
        });
    }
    /*加入购物车*/
    function addToCart(){
        if(validNum()){
            layer.login("addToCartLogin");
        }
    }

    function addToCartLogin(){
        var v = $("#inp").val();
        hasPermission(function(){
            addCart(currentSkuId,v);
            location.href="/cart/success/"+currentSkuId;
        })
    }

    function goBuy() {
        if(validNum()){
            layer.login("goBuyLogin");
        }
    }
    function goBuyLogin() {
        var v = $("#inp").val();
        hasPermission(function(){
            jQuery.my.postForm("/order/submit/product",{data:JSON.stringify([{skuId:currentSkuId,quantity:v}])})
        })
    }


    function validNum(){
        $("#inp").keyup();
        var v = $("#inp").val();
        var cstock = $("#stock").text();
        if(v!="" && (!isNaN(v))){
            if(parseInt(cstock)==0){
                layer.msgShort("该商品已售馨");
                return false;
            }else{
                return true;
            }

        }else{
            layer.msgShort("请选择购买数量!");
            return false;
        }
    }


    /*显示手机号**/
    function showTel(o){
        var span  =$(o).parent("h5").find("span");
        var oldtel = span.text();
        span.text(span.attr("data"));
        span.attr("data",oldtel);
        if($(o).hasClass("blue")){
            $(o).removeClass("blue");
        }else{
            $(o).addClass("blue");
        }
    }
    var bref; //公司简介
    function more(o){
        /*展开*/
        if($(o).attr("data-op")=="kai"){
            $(o).attr("data-op","shou");
            $(o).text("收起");
            var info=$(o).siblings("span").attr("data-info");
            $(o).siblings("span").html(info);
        }else{
            $(o).attr("data-op","kai");
            $(o).text("展开");
            $(o).siblings("span").html(bref);
        }
    }
</script>
</html>